<template>
	<view>
		<view class="content-wrap">
			<view class="content-title">
				<u--text :text="pageType=='noticeList'?content.noticeTitle:pageType=='newsList'?content.newsTitle:''" 
				size="18" bold block align="center"/>
				<u--text :text="content.createBy+' 发布'" size="14" type="info" block margin="20rpx 0 10rpx 0"/>
				<u--text :text="'时间：'+content.createTime" size="13" type="info" block/>
			</view>
			<view class="content" style="margin-top: 10px;text-align: justify;">
				<u-parse :content="pageType=='noticeList'?content.noticeContent:pageType=='newsList'?content.newsContent:''"
				:tagStyle="{p:'font-size:16px;line-height:30px;text-indent:28px;',img:'display:block;width:100%;margin:0 auto'}"></u-parse>
			</view>
		</view>
	</view>
</template>

<script>
	import {mapActions} from 'vuex'
	export default {
		data() {
			return {
				content:{},
				pageType:''
			};
		},
		onLoad(params) {
			this.pageType=params.pageName
			if(params.pageName=='noticeList'){
				this.getNoticeContentAction({data:params.id,success:res=>{
					this.content={...res.data.data}
					/* let restr=this.content.noticeContent.replace(/\<img src\=\"\/dev-api/g,'<img src="'+process.env.VUE_APP_BASE_URL+'/prod-api')
					this.content.noticeContent=restr
					 */
					
					
				}})
			}
			if(params.pageName=='newsList'){
				this.pageType=params.pageName
				this.getNewsContentAction({data:params.id,success:res=>{
					this.content={...res.data.data}
					/* let restr=this.content.noticeContent.replace(/\<img src\=\"\/dev-api/g,'<img src="'+process.env.VUE_APP_BASE_URL+'/prod-api')
					this.content.noticeContent=restr
					 */
					
					
				}})
			}
			
			
			
		},
		methods:{
			...mapActions('m_noticeList',['getNoticeContentAction']),
			...mapActions('m_newsList',['getNewsContentAction'])
		}
	}
</script>

<style lang="scss" scoped>
	.content-wrap{padding:20rpx 30rpx;}
</style>
